﻿using HPIT_Library_Modal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HPIT_Library
{
    public partial class inventory : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GridView1.DataSource = HPIT_Library_BLL.bookManger.Select();
                GridView1.DataBind();
                DropDownList1.DataSource = HPIT_Library_BLL.categoryManger.Select();
                DropDownList1.DataBind();
                DropDownList1.Items.Insert(0, new ListItem("全部","0"));
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            var BookName = txtBook.Text;
            var BookAuthor = txtAscor.Text;
            var CategoryId =Convert.ToInt32(DropDownList1.SelectedValue);
            GridView1.DataSource = HPIT_Library_BLL.bookManger.Select(BookName, BookAuthor, CategoryId);
            GridView1.DataBind();
        }
       
    }
}